import type { PageParms } from "@/types/common"
import type { AllRoleData, ContactUserData, AddRoleData, UserData, UserPermissionData, updateRoleData } from "@/types/system"
import { request } from "@/utils/reuqest"

export const userDataAPI=()=>{
  return request<UserData[]>('park/sys/role')
}
export const getAllRoleDataAPI=()=>{
  return request<AllRoleData[]>('/park/sys/permision/all/tree')
}
export const getUserPermissionDataAPI=(id:number)=>{
  return request<UserPermissionData>(`park/sys/role/${id}`)
}
export const getContactUserDataAPI=(id:number,data?:PageParms)=>{
  return request<ContactUserData>(`/park/sys/roleUser/${id}`,'GET',data)
}
export const AddRoleDataAPI=(data:AddRoleData)=>{
 return request('park/sys/role','POST',data)
}
export const deleteRoleDataAPI=(id:number)=>{
  return request(`park/sys/role/${id}`,'DELETE')
}
export const updateRoleDataAPI=(data:updateRoleData)=>{
  return request(`park/sys/role`,'PUT',data)
}